package com.tang.calculator.symbols;

/**
 * @auther: zhiy
 * @date: 2021/3/22
 * @description:
 */
public class ValueSymbolHelper {
    public static ThreadLocal<Integer> precisionLocal = new ThreadLocal<>();
    private static final int defaultPrecision = 10;

    public static void setPrecision(int precision) {
        precisionLocal.set(precision);
    }

    public static int getPrecision() {
        if (precisionLocal.get() != null) {
            return precisionLocal.get();
        }
        return defaultPrecision;
    }

    public static void removePrecision() {
        precisionLocal.remove();
    }
}
